package com.efast.dmom.mgmt.controller.les.pda;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.efast.cafe.framework.bean.ResultBean;
import com.efast.dmom.mgmt.entity.les.TwQualityTaskDetail;
import com.efast.dmom.mgmt.service.les.TwQualityTaskDetailService;

import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 质检任务子表 前端控制器
 * </p>
 *
 * @author ChenLiPeng
 * @since 2018-05-27
 */
@Controller
@RequestMapping("/twQualityTaskDetail")
public class TwQualityTaskDetailController {

	private final TwQualityTaskDetailService twQualityTaskDetailService;

	@Autowired
	public TwQualityTaskDetailController(TwQualityTaskDetailService twQualityTaskDetailService) {
		this.twQualityTaskDetailService = twQualityTaskDetailService;
	}


	@ApiOperation(value = "【获取任务】")
	@RequestMapping(value = "/getTask", method = RequestMethod.POST)
	public @ResponseBody
	ResultBean grounding(@RequestBody TwQualityTaskDetail twQualityTaskDetail) {
		ResultBean result = new ResultBean(true, "'");
		result.setObject(twQualityTaskDetailService.getTask(twQualityTaskDetail));
		return result;
	}

	@ApiOperation(value = "【质检是否通过】")
	@RequestMapping(value = "/ifPass", method = RequestMethod.POST)
	public @ResponseBody
	ResultBean ifPass(@RequestBody TwQualityTaskDetail twQualityTaskDetail) {
		ResultBean result = new ResultBean(true, "'");
		twQualityTaskDetailService.ifPass(twQualityTaskDetail);
        result.setMessage("成功");
		return result;
	}

}

